class Solution(object):
    def sortedArrayToBST(self, nums:list[int])->TreeNode:
        """
        :type nums: List[int]
        :rtype: TreeNode
        """
        if len(nums)==0:
            return None
        return TreeNode(
                        nums[len(nums)/2]
                        ,self.sortedArrayToBST(nums[:len(nums)/2])
                        ,self.sortedArrayToBST(nums[len(nums)/2+1:])
                        )